/* 到货通知物料信息行数据 */
import { requestClient } from '#/api/request';

export namespace ArrivalNoticeLine {
  export interface Params {
    attr1: null;
  }
  export interface Row {
    searchValue: null;
    createBy: string;
    createTime: Date;
    updateBy: string;
    updateTime: null;
    remark: string;
    params: Params;
    lineId: number;
    noticeId: number;
    itemId: number;
    itemCode: string;
    itemName: string;
    specification: null;
    unitOfMeasure: string;
    unitName: null | string;
    quantityArrival: number;
    quantityQuanlified: number;
    iqcCheck: string;
    iqcId: null;
    iqcCode: null;
    attr2: null;
    attr3: number;
    attr4: number;
    attr1: boolean | null | string;
  }
  export interface GetListParams {
    pageNum: number;
    pageSize: number;
    noticeId: number;
  }
  export interface GetListReturn {
    total: number;
    rows: Row[];
    code: number;
    msg: string;
  }
}

// 获取列表
export const getArrivalNoticeLineTableList = (
  params: ArrivalNoticeLine.GetListParams,
) =>
  requestClient.get<ArrivalNoticeLine.GetListReturn>(
    '/mes/wm/arrivalnoticeline/list',
    {
      params,
    },
  );
// 增加
export const addArrivalNoticeLine = (data: ArrivalNoticeLine.Row) =>
  requestClient.post<ArrivalNoticeLine.GetListReturn>(
    '/mes/wm/arrivalnoticeline',
    data,
  );

// 删除
export const deleteArrivalNoticeLine = (id: string) =>
  requestClient.delete<ArrivalNoticeLine.GetListReturn>(
    `/mes/wm/arrivalnoticeline/${id}`,
  );

// 修改
export const updateArrivalNoticeLine = (data: ArrivalNoticeLine.Row) =>
  requestClient.put<ArrivalNoticeLine.GetListReturn>(
    '/mes/wm/arrivalnoticeline',
    data,
  );
